#ifndef __SG_PCL_HULL_H__
#define __SG_PCL_HULL_H__

#include <pcl/Vertices.h>
#include <pcl/surface/convex_hull.h>

#include "SGPCLJsonConfig.h"

namespace sgpcl
{

template <typename PointT>
std::pair<typename pcl::PointCloud<PointT>::Ptr, std::vector<pcl::Vertices>> Hull(
  typename pcl::PointCloud<PointT>::Ptr spCloud)
{
  pcl::ConvexHull<PointT> hull;
  hull.setInputCloud(spCloud);
  hull.setDimension(2);

  std::vector<pcl::Vertices> polygons;
  pcl::PointCloud<PointT>::Ptr surface_hull(new pcl::PointCloud<PointT>);
  hull.reconstruct(*surface_hull, polygons);

  return { surface_hull, polygons };
}

}

#endif // !__SG_PCL_HULL_H__
